<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title" @click="AA">{{title}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello'
			}
		},
		onLoad() {

		},
		methods: {
		AA(){
			uni.getUserInfo({
				provider: 'weixin',
			})
			uni.login({
			  provider: 'weixin', 
			  scopes:"auth_user",
			  onlyAuthorize:true,
			  success: function (appleInfo) {
				  console.log(appleInfo.code,"this is code");
				  uni.setStorageSync('CODE', appleInfo.code);
			  },
			});	

			let temporaryCode=uni.getStorageSync('CODE')
			uni.request({
			    url: 'http://api.tongxintongyu.com:5001/api/WeiXin/GetOpenId', 
			    data: {
			        AppId: 'wxc049ba06d645dde5',
					Secret:"f049884a8a45ff2569c333181ba62fc7",
					Code:temporaryCode,
			    },
			    success: (res) => {
					console.log(res);
			        console.log(res.data.openid,"this is openId");
					this.title=res.data.openid
			    }
			});
			
		}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
